home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Leonardo the Inventor
/
Leonardo The Inventor (93026)(Broderbund)(Riverdeep)(2004).iso
/
LEOWINMV
/
DATABASE.DIR
/
00101_Script_IMPORT-EXPORT DATA
< prev
next >
Wrap
Text File
|
1996-03-28
|
2KB
|
57 lines
-- --------------------------------------------------------------
-- Handler importDBIndex imports the index of the database from
-- the text file and stores it in cast members named according
-- to the following convention, "A 1 INDEX", "B 1 INDEX" ...
on importDBIndex FirstCast
repeat with letter = 65 to 90
set Filename = numToChar(letter) & ".TXT"
put FileIO(mNew,"READ",the pathname & FileName) into FileObject
put fileObject(mReadToken,"","") into indexText
put findEmpty(cast FirstCast) into NextCast
put indexText after cast NextCast
set the name of cast NextCast to numToChar(letter) & " 1 INDEX"
fileObject(mDispose)
end repeat
end
-- --------------------------------------------------------------
-- Handler exportData puts the articles of the database back in
-- a text file.
-- Example of use:
-- put exportData (301, 369, "TITLE ") into datatext
-- saveDataToFile datatext, "Bev:TEXT.TXT"
on exportData firstCast, lastCast, titleTag
set data = EMPTY
set oldTitle = EMPTY
repeat with C = firstCast to lastCast
set title = the name of cast C
set title = char 1 to length(title) - 6 of title
if NOT (title = oldTitle) then
-- title put twice, so searches can be done on words in the title too
put RETURN & titleTag & title & RETURN & title & RETURN after data
end if
put (the text of cast C) after data
put RETURN after data
set oldTitle = title
end repeat
return data
end
-- --------------------------------------------------------------
-- Handler saveDataToFile saves the given data in the given text
-- file.
on saveDataToFile theData, fileName
put fileio (mNew, "WRITE", fileName) into FileObject
FileObject(mWriteString, theData)
FileObject(mDispose)
end